import service from '@/utils/request'

//127.0.0.1:19090/system/announcement/list
export function getAnnouncementListService(params) {
    return service({
        url: "/announcement/list",
        method: "get",
        params
    });
}

export function getAnnouncementDetailService(announcementId) {
    return service({
        url: "/announcement/detail",
        method: "get",
        params: { announcementId },
    });
}

export function addAnnouncementService(params = {}) {
    return service({
        url: "/announcement/add",
        method: "post",
        data: params,
    });
}

export function delAnnouncementService(announcementId) {
    return service({
        url: "/announcement/delete",
        method: "delete",
        params: { announcementId },
    });
}

export function editAnnouncementService(params = {}) {
    return service({
        url: "/announcement/edit",
        method: "put",
        data: params,
    });
}

// 发布公告
export function publishAnnouncementService(announcementId) {
    return service({
        url: "/announcement/publish",
        method: "put",
        params: { announcementId },
    });
}

// 下架公告
export function unpublishAnnouncementService(announcementId) {
    return service({
        url: "/announcement/unpublish",
        method: "put",
        params: { announcementId },
    });
}